Skip to content

fix(useTourEngine): start tour when run is true and steps load after mount - #1212

Open
ArmaanjeetSandhu wants to merge 1 commit into
gilbarbara:mainfrom
ArmaanjeetSandhu:fix/start-tour-when-steps-load-after-mount
Open

fix(useTourEngine): start tour when run is true and steps load after mount#1212
ArmaanjeetSandhu wants to merge 1 commit into
gilbarbara:mainfrom
ArmaanjeetSandhu:fix/start-tour-when-steps-load-after-mount

Conversation

@ArmaanjeetSandhu

Copy link
Copy Markdown

Addresses #1211

The fix matches the mount effect, i.e., when run && size && status === idle, start the tour if the steps validate.

  • The else branch keeps the prior idle → ready behavior for invalid steps, so the only behavioral change is that valid steps now start.
  • Every added dep is a stable reference or a primitive, and the status === IDLE guard makes any extra fire a no-op, so there's no re-render churn and no double-start with usePropSync (both the "run already true" and "run toggled" paths start exactly once).

One new regression test for this has been added in test/hooks/useTourEngine.spec.ts. The full suite passes, and there are no API changes.

Copilot AI review requested due to automatic review settings July 11, 2026 18:05
@codesandbox

codesandbox Bot commented Jul 11, 2026

Copy link
Copy Markdown

Review or Edit in CodeSandbox

Open the branch in Web EditorVS CodeInsiders

Open Preview

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes a regression in useTourEngine where tours wouldn’t start if run is true from the initial render but steps are populated asynchronously after mount (issue #1211). The updated update-effect now mirrors the mount behavior by starting the tour when run && size && status === IDLE and the provided steps validate.

Changes:

  • Update useTourEngine’s useUpdateEffect to call controls.start(...) (instead of only transitioning to READY) when valid steps arrive after mount while run is already true.
  • Expand the useUpdateEffect dependency list to include the referenced props/values used inside the effect.
  • Add a regression test covering “run already true + steps arrive after mount” and asserting the tour enters RUNNING and emits TOUR_START.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
src/hooks/useTourEngine.ts Starts the tour (not just sets READY) when valid steps arrive after mount and run is already true.
test/hooks/useTourEngine.spec.ts Adds a regression test reproducing #1211 and asserting the tour starts when async steps arrive.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants